# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bsm-simple-themes
pkgver=1.3
_ver=${pkgver/./}
pkgrel=4
pkgdesc="BSM Simple GTK Themes"
url="http://gnome-look.org/content/show.php/?content=121685"
arch="noarch"
license="GPL"
depends="gtk-engines-clearlooks faenza-icon-theme"
subpackages="$pkgname-xfwm4 $pkgname-metacity"
source="https://distfiles.alpinelinux.org/distfiles/121685-BSM%252520Simple%252520$_ver.tar.gz
	bsm-simple-panel.patch
	bsm-simple-xfwm.patch"

builddir="$srcdir"

package() {
	cd "$builddir"
	# fix permissions
	find . -type d -exec chmod 755 '{}' \;
	find . -type f -exec chmod 644 '{}' \;
	mkdir -p "$pkgdir"/usr/share/themes
	for i in *; do
		[ -L "$i" ] && continue
		cp -ra "$i" "$pkgdir"/usr/share/themes/
	done
}

xfwm4() {
	pkgdesc="BSM Simple GTK Themes - xfwm4"
	install_if="$pkgname=$pkgver-r$pkgrel xfwm4"
	cd "$pkgdir"
	find . -name 'xfwm4' -type d | while read dir; do
		mkdir -p "$subpkgdir/${dir%/*}"
		mv "$dir" "$subpkgdir/${dir%*}"
	done
}

metacity() {
	pkgdesc="BSM Simple GTK Themes - metacity"
	install_if="$pkgname=$pkgver-r$pkgrel metacity"
	cd "$pkgdir"
	find . -name 'metacity-?' -type d | while read dir; do
		mkdir -p "$subpkgdir/${dir%/*}"
		mv "$dir" "$subpkgdir/${dir%*}"
	done
}

sha512sums="4254ccdb2869a1caefbac9f9b1bffa6f5bc0a3ba64989d198cd2154d23e5e725dd8f408b17bb37d56eaef6ce74660d29b1167d99b91df7480ddf649957449adb  121685-BSM%252520Simple%25252013.tar.gz
84ad713a7a5850b970a96e97d6c71b81e127a02caead429b71cd50868bfdfce6d327ed113aca40f7a4d4ccfd18f48a84ec27dcbc2af6fe0cbbb47e207ad41e47  bsm-simple-panel.patch
8f015a39d06d6713d75d872fba1139cf734a7ea6af272e198cbc0192148c5eabed3828902a608aa83b2661fc92159057508a9e792f7032680c6f728325b6792f  bsm-simple-xfwm.patch"
